//
//  WQWelComeController.m
//  sanwuWeiboOC
//
//  Created by 王先强 on 15/12/11.
//  Copyright © 2015年 王先强. All rights reserved.
//

#import "WQWelComeController.h"

@interface WQWelComeController ()

@property (nonatomic, weak) UIImageView *iconView;
@property (nonatomic, weak) UILabel *welComeLabel;

@end

@implementation WQWelComeController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    UIImageView *iconView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 90, 90)];
    self.iconView = iconView;
    iconView.image = [UIImage imageNamed:@"avatar_default_big"];
    [self.view addSubview:iconView];
    iconView.centerX = self.view.centerX;
    iconView.centerY = self.view.height * 0.75;
    iconView.layer.cornerRadius = 45;
    iconView.clipsToBounds = YES;
    
    
    UILabel *welComeLabel = [[UILabel alloc] init];
    self.welComeLabel = welComeLabel;
    [self.view addSubview:welComeLabel];
    welComeLabel.text = @"欢迎归来";
    [welComeLabel sizeToFit];
    welComeLabel.textColor = WQRandomColor;
    welComeLabel.centerY = iconView.centerY + 80;
    welComeLabel.centerX = iconView.centerX;

}

-(void)viewDidAppear:(BOOL)animated{
    [super viewDidAppear:animated];
    self.welComeLabel.alpha = 0;
    [UIView animateKeyframesWithDuration:0.45 delay:0.2 options:0 animations:^{
        self.iconView.centerY = self.view.height * 0.3;
    } completion:^(BOOL finished) {
        self.welComeLabel.centerY = self.iconView.centerY + 80;
        self.welComeLabel.alpha = 1;
        
        
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
            
            //界面跳转
            
        });
        
    }];
    
}

- (void)loadView {
    UIImageView *bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ad_background"]];
    self.view = bgImageView;
}

@end
